package co.edu.usbcali.pqr.presentation.dataModel;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

import co.edu.usbcali.pqr.modelo.dto.AreasInvolucradasDTO;
 
public class AreasInvolucradasDataModel extends ListDataModel<AreasInvolucradasDTO> implements SelectableDataModel<AreasInvolucradasDTO> {    
 
   public AreasInvolucradasDataModel() {  
   }  
 
   public AreasInvolucradasDataModel(List<AreasInvolucradasDTO> data) {  
       super(data);  
   }  
     
   @Override  
   public AreasInvolucradasDTO getRowData(String rowKey) {  

		@SuppressWarnings("unchecked")
		List<AreasInvolucradasDTO> lista = (List<AreasInvolucradasDTO>) getWrappedData();  
         
       for(AreasInvolucradasDTO td : lista) {          	
           if(td.getIdAreaInvolucrada().toString().equals(rowKey))  
               return td;  
       }  
         
       return null;  
   }  
 
   @Override  
   public Object getRowKey(AreasInvolucradasDTO td) {  
       return td.getIdAreaInvolucrada();  
   }  

}